package com.ganbo.transation.service;

import com.ganbo.transation.entity.Second;
import com.ganbo.transation.repository.SecondRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class OneService {

    @Autowired
    private SecondRepository secondRepository;

    @Transactional//(propagation = Propagation.REQUIRES_NEW)
    public void saveSecond() {
        Second second = new Second();
        second.setName("s-name");
        secondRepository.save(second);
        int i = 1 / 0;
    }
}
